<template>
  <el-dialog :title="!wtdh_id ? '新增' : !disabled ? '修改' : '查看'"
             customClass="customWidth"
             :append-to-body="true" :close-on-click-modal="false" width="65%" top="1vh"
             :visible.sync="visible">
    <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="210px">
      <el-collapse v-model="activeNames">
        <el-collapse-item title="基本信息" name="1">
          <el-row>
            <el-col :span="12">
              <el-form-item prop="wtdh"
                            :rules="dataForm.isDygd ? dataRule.wtdh : [{require: false}]">
              <span slot="label">
                <i @click="autoDyxx" style="cursor: pointer;color: red" v-show="!wtdh_id">多云预填</i>
                问题单号
              </span>
                <el-input v-model="dataForm.wtdh" :disabled="wtdhdisabled" :maxlength="100" ref="wtdhRef"
                          placeholder="多云单号必录入，非多云单号非必录(后台自动生成)，录入单号回车带出已有的数据"
                          @keyup.enter.native="initDyWtdh"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="是否多云单" prop="isDygd">
                <el-select v-model="dataForm.isDygd"
                           :disabled="wtdhdisabled"
                           placeholder="是否多云单"
                           @change="isDygdChange"
                           filterable
                           class="width100"
                           size="small">
                  <el-option
                    :key="true"
                    label="是"
                    :value="true">
                  </el-option>
                  <el-option
                    :key="false"
                    label="否"
                    :value="false">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item prop="jdsjJf">
              <span slot="label">
                <i @click="autoFdyxx" style="cursor: pointer;color: red" v-show="!wtdh_id">体外预填</i>
                接单时间
              </span>
                <el-date-picker
                  v-model="dataForm.jdsjJf"
                  :disabled="disabled"
                  type="datetime"
                  placeholder="接单时间"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  default-time="00:00:00">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="应用系统" prop="yyxtJf">
                <el-dict code="YYXT_LIST" v-model="dataForm.yyxtJf" placeholder="应用系统" :disabled="disabled" filterable
                         clearable></el-dict>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label="问题标题" prop="wtbt"
                            :rules="!dataForm.isDygd ? dataRule.wtbt : [{require: false}]">
                <el-input v-model="dataForm.wtbt" :disabled="disabled" :maxlength="100" placeholder="问题标题"
                          ref="wtbtRef">
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-collapse-item>
        <el-collapse-item title="问题详情" name="2">
          <el-col :span="12">
            <el-form-item label="联络人信息" prop="zsjllrxx">
              <el-input v-model="dataForm.zsjllrxx" :disabled="disabled" :maxlength="100"
                        placeholder="总/省局联络人信息"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="提单人" prop="tdr">
              <el-input v-model="dataForm.tdr" :disabled="disabled" :maxlength="100"
                        placeholder="提单人/省局提单账号"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="问题分析" prop="sjfxjg">
              <el-input v-model="dataForm.sjfxjg" type="textarea" :rows="2" :maxlength="500" :disabled="disabled"
                        placeholder="问题分析（用于生成周报以及放入常见问题），描述该业务的前后业务逻辑，如何实现等等"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="解决方案" prop="jjfaJf">
              <el-input v-model="dataForm.jjfaJf" :disabled="disabled" type="textarea" :rows="3" :maxlength="500"
                        placeholder="解决方案（用于生成周报以及放入常见问题），如：临时方案调整应用程序中XXX配置后重启XXX应用，彻底解决方案需对应用程序进行修改等"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="问题简述" prop="wtjsJf">
              <el-input v-model="dataForm.wtjsJf" :disabled="disabled" type="textarea" :rows="3" :maxlength="300"
                        placeholder="对问题详述内容进行概要描述（用于生成周报以及放入常见问题），如：新电局调用税撑XXXX关联关系，返给电子税局的报文字段XX，多次调用结果不一致"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="问题详述" prop="wtms"
                          :rules="!dataForm.isDygd ? dataRule.wtms : [{require: false}]">
              <ueditor v-model="dataForm.wtms" :height="200" :disabled="disabled"></ueditor>
            </el-form-item>
          </el-col>
        </el-collapse-item>
        <el-collapse-item title="处理结果" name="4">
          <el-col :span="12">
            <el-form-item label="对应厂商" prop="dycsYf" :rules="!dataForm.isDygd ? dataRule.dycsYf : [{require: false}]">
              <el-dict code="DYCS_LIST" v-model="dataForm.dycsYf" placeholder="对应厂商" :disabled="disabled" clearable
                       filterable></el-dict>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="乙方负责人" prop="yffzrYf"
                          :rules="!dataForm.isDygd ? dataRule.yffzrYf : [{require: false}]">
              <el-input v-model="dataForm.yffzrYf" :disabled="disabled" :maxlength="100" placeholder="乙方负责人"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="问题专题" prop="wtztYf">
              <el-dict code="XTZT_LIST" v-model="dataForm.wtztYf" placeholder="问题专题" clearable filterable
                       :disabled="disabled"></el-dict>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="严重程度" prop="yzcd" :rules="dataRule.yzcd">
              <el-select v-model="dataForm.yzcd"
                         :disabled="disabled"
                         class="width100"
                         filterable
                         placeholder="严重程度"
                         size="small">
                <el-option key="轻微" label="轻微" value="轻微"></el-option>
                <el-option key="一般" label="一般" value="一般"></el-option>
                <el-option key="严重" label="严重" value="严重"></el-option>
                <el-option key="阻断" label="阻断" value="阻断"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="解决方案" prop="yfjjfaYf"
                          :rules="(dataForm.dyztJf === '已解决待验证'||dataForm.dyztJf === '已完成') ? dataRule.yfjjfaYf : [{require: false}]">
              <el-dict code="RESOLUTION_LIST" v-model="dataForm.yfjjfaYf" placeholder="解决方案" clearable filterable
                       @change="yfjjfaYfChange"
                       :disabled="disabled"></el-dict>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="退回理由" prop="thlyYf"
                          :rules="dataForm.yfjjfaYf === 'frontline' ? dataRule.thlyYf : [{require: false}]">
              <el-dict code="THLY_LIST" v-model="dataForm.thlyYf" placeholder="退回理由" clearable filterable
                       :disabled="disabled"></el-dict>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="问题类型-乙方" prop="wtlxYf">
              <el-dict code="WTLXYF_LIST" v-model="dataForm.wtlxYf" :disabled="disabled" placeholder="问题类型-乙方" clearable
                       filterable></el-dict>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="问题状态" prop="dyztJf">
              <el-dict code="DYZTJF_LIST" v-model="dataForm.dyztJf" placeholder="问题状态" :disabled="disabled" clearable
                       filterable></el-dict>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="问题来源" prop="wtly" :rules="!dataForm.isDygd ? dataRule.wtly : [{require: false}]">
              <el-dict code="WTLY_SF_LIST" v-model="dataForm.wtly" placeholder="问题来源" :disabled="disabled" clearable
                       filterable></el-dict>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="解决时间" prop="jjrqYf"
                          :rules="(dataForm.dyztJf === '已解决待验证'||dataForm.dyztJf === '已完成') ? dataRule.jjrqYf : [{require: false}]">
              <el-date-picker
                v-model="dataForm.jjrqYf"
                :disabled="disabled"
                type="datetime"
                placeholder="解决时间"
                value-format="yyyy-MM-dd HH:mm:ss"
                default-time="00:00:00">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="内部流转单号" prop="yfnblzdhYf">
              <el-input v-model="dataForm.yfnblzdhYf" :disabled="disabled" :maxlength="100"
                        placeholder="乙方内部流转单号"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="数据运维数量" prop="sjywsl">
              <el-input-number v-model="dataForm.sjywsl" :step="100" :disabled="sjywsldisabled"
                               ref="sjywslRef"
                               placeholder="数据运维数量"></el-input-number>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="总省标志" prop="zsbz">
              <el-dict code="ZJSJBZ_LIST" v-model="dataForm.zsbz" placeholder="用于监理验收统计，注意识别" :disabled="disabled"
                       filterable></el-dict>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="流经次数" prop="ljcs">
              <el-input-number v-model="dataForm.ljcs" :step="100" :disabled="true"
                               placeholder="流经次数"></el-input-number>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="重大问题" prop="isZdwt">
              <el-select v-model="dataForm.isZdwt"
                         :disabled="disabled"
                         placeholder="是否多云单"
                         filterable
                         class="width100"
                         size="small">
                <el-option
                  :key="true"
                  label="是"
                  :value="true">
                </el-option>
                <el-option
                  :key="false"
                  label="否"
                  :value="false">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="问题标签" prop="markYf">
              <el-input v-model="dataForm.markYf" :disabled="disabled" :maxlength="100"
                        placeholder="问题标签"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="备注" prop="bzYf">
              <el-input v-model="dataForm.bzYf" :disabled="disabled" type="textarea" :rows="4"
                        placeholder="备注"></el-input>
            </el-form-item>
          </el-col>
        </el-collapse-item>
      </el-collapse>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">关闭</el-button>
      <el-button v-if="!disabled" type="success" @click="nextSubmit()">新提交一单</el-button>
      <el-button v-if="!disabled&&wtdh_id" type="success" @click="copySubmit()">复制到新单</el-button>
      <el-button v-if="!disabled" type="primary" @click="dataFormSubmit()">确定</el-button>
      <el-button v-if="disabled&&isAuth('zr:dytz:converZentao')" type="danger" @click="converZentao()">转禅道</el-button>
      <el-button v-if="!dataForm.isZbnr" type="warning" @click="setWeekBook()">写入周报</el-button>
       <el-button v-if="dataForm.isZbnr" type="warning" @click="cancleWeekBook()">取消周报写入</el-button>
    </span>
    <edit-zentao-bug v-if="zentaoVisible" ref="zentaoRef"></edit-zentao-bug>
    <weekreport v-if="weekreportVisible" ref="weekreportRef" @weekreportBack="weekreportBack"></weekreport>
  </el-dialog>
</template>

<script>
import editZentaoBug from '../zt/editZentaoBug'
import weekreport from '../zt/weekreport'

export default {
  data() {
    return {
      disabled: false,
      visible: false,
      wtdhdisabled: false,
      sjywsldisabled: false,
      zentaoVisible: false,
      weekreportVisible: false,
      activeNames: ['1'],
      wtdh_id: '', // 用于判断新增或者修改判断，单独加一个，不放到wtdh里边，有可能被覆盖
      dataForm: {
        wtdh: '',
        wtbt: '',
        isDygd: true,
        wtms: '',
        zsjllrxx: '',
        sjgddh: '',
        tdr: '',
        sjfxjg: '',
        yzcd: '',
        wtly: '',
        yyxtJf: '',
        jffzrJf: '',
        jdsjJf: '',
        gnmkJf: '',
        wtjsJf: '',
        clqkJf: '',
        wtlxJf: '',
        wtyyJf: '',
        jjfaJf: '',
        gdsjJf: '',
        dyztJf: '',
        szcjjztJf: '',
        ywscJf: '',
        codingbhJf: '',
        codingfbsjJf: '',
        bzJf: '',
        dycsYf: '',
        yffzrYf: '',
        wtztYf: '',
        yfjjfaYf: '',
        thlyYf: '',
        wtlxYf: '',
        yfnblzdhYf: '',
        sjywsl: 0,
        isZdwt: false,
        isZbnr: false,
        markYf: '',
        jjrqYf: '',
        bzYf: '',
        ljcs: '',
        zsbz: ''
      },
      dataRule: {
        wtdh: [
          {required: true, message: '问题单号不能为空', trigger: 'blur'}
        ],
        wtbt: [
          {required: true, message: '问题标题不能为空', trigger: 'blur'}
        ],
        isDygd: [
          {required: true, message: '是否多云单不能为空', trigger: 'blur'}
        ],
        dyztJf: [
          {required: true, message: '问题状态不能为空', trigger: 'blur'}
        ],
        yfjjfaYf: [
          {required: true, message: '解决方案不能为空', trigger: 'blur'}
        ],
        thlyYf: [
          {required: true, message: '退回理由不能为空', trigger: 'blur'}
        ],
        jjrqYf: [
          {required: true, message: '解决时间不能为空', trigger: 'blur'}
        ],
        jdsjJf: [
          {required: true, message: '接单时间不能为空', trigger: 'blur'}
        ],
        yyxtJf: [
          {required: true, message: '应用系统不能为空', trigger: 'blur'}
        ],
        dycsYf: [
          {required: true, message: '对应厂商不能为空', trigger: 'blur'}
        ],
        yffzrYf: [
          {required: true, message: '乙方负责人不能为空', trigger: 'blur'}
        ],
        wtztYf: [
          {required: true, message: '问题专题不能为空', trigger: 'blur'}
        ],
        wtlxYf: [
          {required: true, message: '问题类型不能为空', trigger: 'blur'}
        ],
        yzcd: [
          {required: true, message: '严重程度不能为空', trigger: 'blur'}
        ],
        isZdwt: [
          {required: true, message: '是否重大问题不能为空', trigger: 'blur'}
        ],
        zsbz: [
          {required: true, message: '总省标准问题不能为空', trigger: 'blur'}
        ],
        wtly: [
          {required: true, message: '问题来源不能为空', trigger: 'blur'}
        ],
        wtms: [
          {required: true, message: '问题描述不能为空', trigger: 'blur'}
        ]
      }
    }
  },
  components: {
    editZentaoBug,
    weekreport
  },
  methods: {
    // 初始化问题单号，回车按键处理
    initDyWtdh() {
      if (this.dataForm.wtdh.length < 8) {
        this.$message({
          message: '多云单号的长度不能少于8位',
          type: 'error'
        })
        return
      }
      this.queryDydhxxByWtdh(this.dataForm.wtdh)
    },
    init(wtdh, disabled) {
      this.activeNames = ['1', '4']
      this.disabled = disabled
      this.sjywsldisabled = disabled
      this.wtdh_id = wtdh || ''
      this.visible = true
      this.$nextTick(() => {
        // 重置表单数据
        this.$refs['dataForm'].resetFields()
        // 非表单上的数据重置
        this.dataForm.isZbnr = false
        // this.dataForm.zsbz = 'ZJD'
        if (this.wtdh_id) {
          this.queryDydhxxByWtdh(this.wtdh_id)
        }
        // 新增的情况默认值
        if (!wtdh && !disabled) {
          this.wtdhdisabled = false
        } else {
          this.wtdhdisabled = true
          // 编辑情况，如果没有乙方负责人，状态是待受理的情况
          setTimeout(() => {
            if (!this.dataForm.yffzrYf && this.dataForm.dyztJf === '待受理') {
              this.dataForm.dyztJf = '处理中'
              this.getGrxx()
            }
          }, 800)
        }
      })
    },
    queryDydhxxByWtdh(wtdh) {
      this.$http({
        url: `/zr/dytz/info/${wtdh}`,
        method: 'get'
      }).then(({data}) => {
        if (data && data.code === 0) {
          this.dataForm.wtdh = data.dytz.wtdh
          this.dataForm.wtbt = data.dytz.wtbt
          this.dataForm.isDygd = data.dytz.isDygd
          this.dataForm.wtms = data.dytz.wtms
          this.dataForm.zsjllrxx = data.dytz.zsjllrxx
          this.dataForm.sjgddh = data.dytz.sjgddh
          this.dataForm.tdr = data.dytz.tdr
          this.dataForm.sjfxjg = data.dytz.sjfxjg
          this.dataForm.yzcd = data.dytz.yzcd
          this.dataForm.wtly = data.dytz.wtly
          this.dataForm.yyxtJf = data.dytz.yyxtJf
          this.dataForm.jffzrJf = data.dytz.jffzrJf
          this.dataForm.jdsjJf = data.dytz.jdsjJf
          this.dataForm.gnmkJf = data.dytz.gnmkJf
          this.dataForm.wtjsJf = data.dytz.wtjsJf
          this.dataForm.clqkJf = data.dytz.clqkJf
          this.dataForm.wtlxJf = data.dytz.wtlxJf
          this.dataForm.wtyyJf = data.dytz.wtyyJf
          this.dataForm.jjfaJf = data.dytz.jjfaJf
          this.dataForm.gdsjJf = data.dytz.gdsjJf
          this.dataForm.dyztJf = data.dytz.dyztJf
          this.dataForm.szcjjztJf = data.dytz.szcjjztJf
          this.dataForm.ywscJf = data.dytz.ywscJf
          this.dataForm.codingbhJf = data.dytz.codingbhJf
          this.dataForm.codingfbsjJf = data.dytz.codingfbsjJf
          this.dataForm.bzJf = data.dytz.bzJf
          this.dataForm.dycsYf = data.dytz.dycsYf
          this.dataForm.yffzrYf = data.dytz.yffzrYf
          this.dataForm.wtztYf = data.dytz.wtztYf
          this.dataForm.yfjjfaYf = data.dytz.yfjjfaYf
          this.dataForm.wtlxYf = data.dytz.wtlxYf
          this.dataForm.yfnblzdhYf = data.dytz.yfnblzdhYf
          this.dataForm.markYf = data.dytz.markYf
          this.dataForm.jjrqYf = data.dytz.jjrqYf
          this.dataForm.bzYf = data.dytz.bzYf
          this.dataForm.sjywsl = data.dytz.sjywsl
          this.dataForm.isZdwt = data.dytz.isZdwt
          this.dataForm.isZbnr = data.dytz.isZbnr
          this.dataForm.ljcs = data.dytz.ljcs
          this.dataForm.zsbz = data.dytz.zsbz
          this.dataForm.thlyYf = data.dytz.thlyYf
          // 有数据就禁止修改稿单号和是否多云单号
          this.wtdhdisabled = true
          this.wtdh_id = data.dytz.wtdh
        }
      })
    },
    // 表单提交
    dataFormSubmit() {
      let _this = this
      this.$refs['dataForm']
        .validate((valid) => {
          if (valid) {
            if (!this.dataForm.wtdh && this.dataForm.isDygd) {
              this.$message({
                message: '[是否多云单号]为[是]的情况需要录入实际多云单号，非多云单号系统自动生成一个单号',
                type: 'error',
                duration: 5500
              })
              return
            }
            if (this.dataForm.wtdh.startsWith('PBI') && this.dataForm.wtdh.length !== 17) {
              this.$message({
                message: 'PBI单号不合法，只能是17位，请再与多云核实确认(多云单号务必准确)',
                type: 'error',
                duration: 5500
              })
              return
            }
            if (this.dataForm.wtdh.startsWith('IM') && this.dataForm.wtdh.length !== 16) {
              this.$message({
                message: 'IM单号不合法，只能是16位，请再与多云核实确认(多云单号务必准确)',
                type: 'error',
                duration: 5500
              })
              return
            }
            this.$http({
              url: `/zr/dytz/${!this.wtdh_id ? 'save' : 'update'}`,
              method: 'post',
              data: this.dataForm
            }).then(({data}) => {
              if (data && data.code === 0) {
                _this.init(data.wtdb, false)
                this.$message({
                  message: '操作成功,操作问题单号：' + data.wtdb,
                  type: 'success',
                  duration: 3500
                })
                // this.visible = false
                this.$emit('refreshDataList')
              }
            })
          } else {
            this.$message({
              message: '功能上有数据项校验未通过，请注意检查页面上的数据项提示',
              type: 'error',
              duration: 3500
            })
          }
        })
    },
    nextSubmit() {
      this.$confirm(`[新提交一单]将把数据清空，请确定数据已保存，确定继续进行?`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.init(undefined, false)
      }).catch(() => {
      })
    },
    copySubmit() {
      this.$confirm(`[复制到新单]将数据复制到新的一单，确定继续进行?`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.wtdh_id = ''
        this.dataForm.wtdh = ''
        this.dataForm.isZbnr = false
        this.dataForm.wtms = ''
        this.dataForm.wtjsJf = ''
        this.wtdhdisabled = false
      }).catch(() => {
      })
    },
    cancleWeekBook() {
      this.$http({
        url: `/zr/dytz/cancleWeekReport/${this.dataForm.wtdh}`,
        method: 'get'
      }).then(({data}) => {
        if (data && data.code === 0) {
          this.dataForm.isZbnr = false
          this.$message({
            message: `操作成功，已取消纳入周报，单号：${this.dataForm.wtdh}`,
            type: 'success',
            duration: 3500
          })
          this.dataForm.isZbnr = false
        }
      })
    },
    setWeekBook() {
      // 写入周报
      if (!this.dataForm.wtdh) {
        this.$message({
          message: '请先保存该运维单信息后再进行【写入周报】操作',
          type: 'error',
          duration: 3500
        })
        return
      }
      this.weekreportVisible = true
      this.$nextTick(() => {
        this.$refs.weekreportRef.init(this.dataForm)
      })
    },
    getNowFormatDate() {
      var date = new Date()
      var year = date.getFullYear() // 获取完整的年份(4位)
      var month = date.getMonth() + 1 // 获取当前月份(0-11,0代表1月)
      var strDate = date.getDate() // 获取当前日(1-31)
      if (month < 10) month = `0${month}` // 如果月份是个位数，在前面补0
      if (strDate < 10) strDate = `0${strDate}` // 如果日是个位数，在前面补0

      return `${year}-${month}-${strDate}`
    },
    /**
     * 带时分秒的当前时间
     * @returns {string}
     */
    getNowFormatDateSfm() {
      var date = new Date()
      const args = {
        y: date.getFullYear(),
        M: date.getMonth() + 1,
        d: date.getDate(),
        h: date.getHours(),
        m: date.getMinutes(),
        s: date.getSeconds()
      }
      for (const key in args) {
        const value = args[key]
        if (value < 10) args[key] = '0' + value
      }
      return args.y +
        '-' +
        args.M +
        '-' +
        args.d +
        ' ' +
        args.h +
        ':' +
        args.m +
        ':' +
        args.s
    },
    /**
     * 多云单预填
     */
    autoDyxx() {
      this.dataForm.wtdh = 'IM' + this.getNowFormatDate().replaceAll('-', '') + '000'
      this.dataForm.isDygd = true
      this.$refs.wtdhRef.focus()
      this.commonYtxx()
    },
    /**
     * 非多云单预填
     */
    autoFdyxx() {
      // 非多云预填
      this.dataForm.isDygd = false
      this.dataForm.wtdh = ''
      this.$refs.wtbtRef.focus()
      this.commonYtxx()
    },
    /**
     * 预填公共数据
     */
    commonYtxx() {
      this.dataForm.jdsjJf = this.getNowFormatDateSfm()
      this.dataForm.jdsjJf = this.getNowFormatDate() + ' 00:00:00'
      this.dataForm.dyztJf = '处理中'
      this.dataForm.yzcd = '一般'
      this.dataForm.zsbz = 'ZJD'
      this.dataForm.isZdwt = false
      this.getGrxx()
    },
    getGrxx() {
      this.$http({
        url: `/zr/dytz/getCreatInitData`,
        method: 'post'
      }).then(({data}) => {
        if (data && data.code === 0) {
          // var user = data.user
          this.dataForm.yffzrYf = this.$store.state.user.realName
          // this.dataForm.jjrqYf = this.getNowFormatDate() + ' 00:00:00'
          this.dataForm.dycsYf = data.dycs
        }
      })
    },
    converZentao() {
      this.zentaoVisible = true
      this.$nextTick(() => {
        this.$refs.zentaoRef.initDyWtdh(this.wtdh_id, true)
      })
    },
    isDygdChange(val) {
      if (!val) {
        this.dataForm.wtdh = ''
        this.dataForm.isDygd = val
      }
    },
    yfjjfaYfChange(val) {
      if (!val) {
        this.dataForm.jjrqYf = ''
      } else {
        this.dataForm.dyztJf = '已解决待验证'
        if (!this.dataForm.jjrqYf) {
          this.dataForm.jjrqYf = this.getNowFormatDateSfm()
        }
        if (this.dataForm.jjrqYf.indexOf('2099') >= 0) {
          this.dataForm.jjrqYf = this.getNowFormatDateSfm()
        }
        // 如果是不是打回一线处理，则不需要填写退回理由
        if (val !== 'frontline') {
          this.dataForm.thlyYf = ''
        }

        // 解决方案是要进行运维处理的，需要填入运维数量
        if (val === 'fixeddatao' || val === 'postponed') {
          this.$refs.sjywslRef.focus()
          this.sjywsldisabled = false
        } else {
          this.sjywsldisabled = true
          this.dataForm.sjywsl = '0'
        }
      }
    },
    weekreportBack() {
      this.weekreportVisible = false
      this.dataForm.isZbnr = true
    }
  }
}
</script>
<style>
.customWidth {
  width: 75%;
}

.el-dialog__body {
  padding: 10px 20px;
}

.el-dialog__header {
  padding: 20px 20px 0px;
}

.el-button {
  margin: 0 5px;
}
</style>
